﻿@model HanGu.Entity.MemberInfo
@{
    ViewBag.Title = "我的汉古";
    Layout = "~/Views/Shared/Main.cshtml";
    TempData["sidecalss"] = "EveryDayWisdom";

    TempData["TitlePic"] = Model.PicPath.Replace("_B.", "_S.");
    TempData["ContorlID"] = "Introduction";
    TempData["Remark"] = Model.Introduction;
    TempData["GropName"] = Model.GUID;
    var SexList = ViewData["SexList"] as SelectList;
    var IsMarryList = ViewData["IsMarry"] as SelectList;
    var ProviceList = ViewData["Provice"] as SelectList;
    var CityList = ViewData["City"] as SelectList;
    var NativePlaceList = ViewData["NativePlace"] as SelectList;
    var JobList = ViewData["Job"] as SelectList;
    var TradeList = ViewData["Trade"] as SelectList;
    var InterestList = ViewData["Interest"] as SelectList;
    List<string> InterestArry = new List<string>();
    if (Model.Interest != null)
    { InterestArry.AddRange(Model.Interest.Split(',')); }
    var MemberGrade = ViewData["MemberGrade"] as SelectList;
    var Degree = ViewData["Degree"] as SelectList;

    var ChangeCharges = ViewData["ChangeCharge"] as List<HanGu.Entity.VChangeChargeRecorde>;//充值积分
    var ChangeGrades = ViewData["ChangeGrade"] as List<HanGu.Entity.VChangeGradeRecorde>;//学位变更
    var ChargeProducts = ViewData["ChargeProduct"] as List<HanGu.Entity.VChargeRecorde>;//兑换产品

    var messages = ViewData["Messages"] as List<HanGu.Entity.Message>;
    int i = 1;
    var SearchParma = ViewData["SearchParma"] as HanGu.Entity.UniversallySearchParam ?? new HanGu.Entity.UniversallySearchParam();
    ViewData["pageform"] = "MyMessageForm";

}
@section Header
{
    <style>
        .contentLeft
        {
            width: 100%;
        }
        #partContent
        {
            width: 100%;
        }
        .movieContain
        {
            width: 100%;
            margin-top: 5px;
        }
        .table th
        {
            font-weight: bold;
        }
        .table td
        {
            border-bottom: 1px solid #ccc;
        }
    </style>
}
@section Banner
{
    @Html.Partial("Banner")
}
@section Content{
 <form id="MyMessageForm" method="post" action="/Vip/MyMessage">
    <input type="hidden" name="pageNum" value="@SearchParma.Pagination.CurrentIndex" />
    <input type="hidden" name="PageTotal" value="@SearchParma.Pagination.PageTotal" />
    <input type="hidden" name="RowCount" value="@SearchParma.Pagination.RowCount" />
    <input type="hidden" name="orderField" value="${param.orderField}" />
    <input type="hidden" name="Title" value="@SearchParma.Ttile" />
    <input type="hidden" name="StarTime" value="@SearchParma.StarDateTime" />
    <input type="hidden" name="EndTime" value="@SearchParma.EndDateTime" />
    </form>
    <div class="contentLeft">
        <table cellpadding="0" cellspacing="0" id="partContent" style="height: 100%;">
            <tr>
                <td>
                    <div class="ContentTitle">
                        <div class="ContentTitleLeft">
                            <img src="/Content/images/vipmyhanguTitle.gif" width="145" height="26" alt=""></div>
                        <div class="ContentTitleRight">
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td class="content">
                    <div class="contentLeft" style="height: 550px; width: 150px; background-color: #ccc">
                        @Html.Partial("vipLeftMenu")
                    </div>
                    <div class="contentLeft MyInfo" style="height: 100%; width: 500px; margin-left: 20px;">
                        <div>
                            <p>
                                <label>
                                    是否接收短信：</label>
                                @Html.CheckBox("NoSMS", Model.NoSMS.Value)
                                <label>
                                    是否接收邮件：</label>
                                @Html.CheckBox("NoEmail", Model.NoEmail.Value)
                                <label>
                                <input type="button" value="保存" style="width:50px"  onclick="SetMessage()" />
                                </label>
                            </p>
                            
                        </div>
                        <table class="table" width="100%" layouth="170" style="border: 1px solid #ccc;">
                            <thead>
                                <tr class="header" style="background-color: #ccc; height: 25px;">
                                    <th style="width: 50px">
                                        序号
                                    </th>
                                    <th>
                                        类型
                                    </th>
                                    <th>
                                        标题
                                    </th>
                                    <th>
                                        发送人
                                    </th>
                                    <th>
                                        发送时间
                                    </th>
                                    <th>
                                        状态
                                    </th>
                                    <th>
                                        详细
                                    </th>
                                </tr>
                            </thead>
                            @foreach (var item in messages)
                            {
                                var action = "email";
                                action = item.Type == 0 ? "SMS" : "Email";
                      
                                <tr>
                                    <td>
                                        @i
                                    </td>
                                    <td>
                                        @if (item.Type == 0)
                                        { 
                                            <span>短信</span>
                                        }
                                        else
                                        { 
                                            <span>邮件</span>
                                        }
                                    </td>
                                    <td>
                                        @item.Title
                                    </td>
                                    <td>
                                        @item.Creator
                                    </td>
                                    <td>
                                        <span formatdate="yyyy-MM-dd hh:mm">
                                            @item.CreateTime</span>
                                    </td>
                                    <td>
                                        @if (item.State == 0)
                                        {
                                            <span style="color: red">未阅读</span>
                                        }
                                        else
                                        {
                                            <span>已阅读</span>
                                        }
                                    </td>
                                    <td>
                                        <a href="/vip/messagedetail/@item.ID">详细</a>
                                    </td>
                                </tr>
                                        i += 1;
                            }
                        </table>
                         @Html.Partial("PageBar")
                    </div>
                </td>
            </tr>
        </table>
    </div>
}
@section Side{
    @Html.Partial("Side")
}
<script>
    function SetMessage() {
        $.ajax({
            type: "POST",
            url: "/vip/SetMessage",
            data: "NoSMS=" + $("#NoSMS").attr("checked") + "&NoEmail=" + $("#NoEmail").attr("checked"),
            success: function (data) {
                var json = eval("(" + data + ")");
                //if (json.statusCode == 200) {
                    alert(json.message);
                //}
                //else {
               //     alert(json.message);
               // }
            }
        });

    }
    
</script>
